#include "stdafx.h"
#include <unistd.h>
#include <signal.h>
#include "CmdServer.h"
#include "McuManager.h"
#include "VanException.h"
#include "McuCmd.h"

int main(int argc, char* argv[])
{
	string str;
	int port = 0;
	CmdServer* pCmdServer = CmdServer::Instance();

	uv_os_setenv("UV_THREADPOOL_SIZE", "16");

	if (argc > 1) {
		port = atoi(argv[1]);
	}

	if (pCmdServer->Start()) {
		printf("CmdServer Start Success, Port = %d\n", pCmdServer->GetPort());
	} else {
		printf("CmdServer Start Failed.\n");
		goto END;
	}

	McuManager::Instance()->Open();

	printf("SysMcu Startup Finish!\n");
	printf("----------------------------------------\n");

	while (true) {
		if ('q' == getchar()) {
			break;
		}
	}

END:
	printf("SysMcu Exit.\n");
	return 0;
}
